#!/bin/sh
files=*.test
cache=""
ways=""
bs=""
errorBlock=""
errorSize=""
errorWays=""

for f in `ls $files`
do
	echo "Archivo a procesar: $f"
	while read l
	do
		cache="$(echo $l | cut -d\; -f1)"
		ways="$(echo $l | cut -d\; -f2)"
		bs="$(echo $l | cut -d\; -f3)"
		./tp2 $cache $ways $bs > tp2.txt
		errorBlock=`cat tp2.txt | grep 'Error en block size ->'`
		errorSize=`cat tp2.txt | grep 'Error en cache size ->'`
		errorWays=`cat tp2.txt | grep 'Error en ways ->'`
		allErr="$errorBlock$errorSize$errorWays"		
		if [ -z "$allErr" ]		
		then
			echo "tp2 $cache $ways $bs -> OK" 
		else
			echo "tp2 $cache $ways $bs -> Errores: $errorBlock $errorSize $errorWays" 
		fi
	done < $f
done


